perm filename TEST[E,ALS]7 blob sn#155283 filedate 1975-04-21 generic text, type T, neo UTF8
00100	COMMENT ⊗   VALID 00003 PAGES
00200	C REC  PAGE   DESCRIPTION
00300	C00001 00001
00400	C00002 00002	E -- DISPLAY EDITOR FOR STANFORD
00500	C00012 00003	RIGHT HALF FLAGS
00600	C00015 ENDMK
00700	C⊗;
     

00100	;E -- DISPLAY EDITOR FOR STANFORD
00200	;Written by Frederick H.G. Wright II
00300	;with modifications by D. Poole, Art Samuel, and Stan Kugell.
00400	;The Essay program was contracted by John Mccarthy and written by Stan Kugell
00500	
00600	PRINTS /Type 0 to get ETV, 1 to get ESSAY, then <CTRL><META><LF>./
00700	ESSFLG←←.INSER TTY:
00800	
00900	IFE ESSFLG<TITLE ETV -- DISPLAY EDITOR FOR STANFORD↔SUBTTL FREDERICK H.G. WRIGHT II
01000	PRINTS /       You are assembling ETV, the Stanford Display Editor
01100	/
01200	PRINTS/	MAR.28,1975  E.29(P481) Apr.6 1975 E.31(P487)	Apr.7 1975 E.32(P487)
01300	APR 10 1975 E.33(P487)	APR 14 E.34
01400	E.32 contains code for TELLME but no automatic calling
01500	E.32 Reloaded on April 8 with minor corrections.
01600	E.33 With some automatic calling (checksum error and UFATAL calls) Apr. 10 1975.
01700	E.34 ALINE bug fixed Apr.14 1975
01800	E.35 Fix for file-directory disagreements. Apr. 18 1975
01900	/>
02000	
02100	IFN ESSFLG<TITLE ESSAY
02200	PRINTS /       You are assembling Essay.
02300	/>
02400	DEFINE ESSAY <IFN ESSFLG>
02500	DEFINE NOESS <IFE ESSFLG>
02600	
02700	COMMENT ⊗ TO PUT UP A NEW E WITH AN UPPER SEGMENT, USE THE COMMANDS:
02800	
02900	.LOA %SE%1<%2V%1B	;LOADS WITH SYMBOLS AND NNRAID IN THE UPPER SEGMENT
03000	.S 137			;RENAMES UPPER, WRITE PROTECTS AND SETS ITS PROTECTION CONSTANT
03100	.SSAVE SYS E		;BE SURE TO SSave (to keep the UPPER SEGMENT around)
03200	
03300	Early versions of E that were up for varying lengths of time:
03400	Nov. 6 1974. E.7        Nov. 8 1974. E.8        Nov.17 1974. E.10
03500	Nov.18 1974. E.10       Dec. 3 1974. E.12       Dec. 9 1974. E.15
03600	Dec.10 1974. E.16(P424) Dec.14 1974. E.17(P431) DEC.17 1974. E.18(P431)
03700	Dec.18 1974. E.19(P431) Jan.3 1975. E.20(P439   Jan.5,1975   E.21(P439)
03800	Jan.10,1975. E.22(P442) Jan 15,1975  E.23(P442) Mar.12,1975. E.26(P474)
03900	Mar.13,1975  E.27       Mar.17 1975  E.27(P477) Mar.19 1975  E.28(P477)
04000	
04100	DATA STRUCTURE.
04200		A page  of text is  represented in memory  as a theaded  list of
04300	items  each representing a  single line of  the text. Each  item in this
04400	representation contains four  words of header  information, the text  of
04500	the line in question and one trailer word.
04600		The first header word contains a TXTCOD, which for ordinary text
04700	is a 2 in the left half and the total number of words in the right half. 
04800	This word  is used by the free storage  management routines. It does not
04900	seem to be used by the text manipulation sections of the code.  The word
05000	count is duplicated in  the trailer word which is also  used only by the
05100	free storage routines. 
05200		The  second  header  word is  a  pointer word.    It  contains a
05300	backward pointer  in  the left  half  pointing to  the location  of  the
05400	pointer  word of  the previous  item  and in  the right  half  a forward
05500	pointer to  the location  of the  pointer  word of  the next  item.  The
05600	location of the pointer word for the first item is contained in the word
05700	at  PAGE and  the  backward pointer  for the  first item points  back to
05800	PAGE. The last item on the page points to the word BOTSTR and  this word
05900	points back to this last item and forward to itself.  When in the ATTACH
06000	mode,   the  location  ATTBUF points  to the pointer  word of  the first
06100	attached line and back to the pointer word of the last attached line.
06200		The third word contains  flag bits in the left  half identifying
06300	the type  of the line and two  9-bit bytes in the right  half. Flag bits
06400	which have been identified are:
06500		400000	 the line is a page mark.
06600		200000	 the line is ARRLIN (CURRENT to which the arrow points).
06700		100000	 the line is WINLIN (the first line on the window).
06800		040000   the line is an Essay reference (for the ESSAY version).
06900	The  first byte  in  the right  half  contains the  total  count of  the
07000	characters as the line is stored on the disk, where a TAB symbol counts
07100	1 and the terminating CR and LF are counted.
07200	The  second byte  contains  the  count of  the  characters as  they  are
07300	displayed where a TAB is counted as the number of spaces it produces and
07400	the terminating CR and LF are not counted. 
07500	
07600		The fourth word is the serial number of the line as kept in the
07700	core. This number is changed every time that a change is made to the line
07800	so this number then bears no relationship to the position of the line on
07900	the page.
08000	
08100		The text occupies an integral number of words and is  padded out
08200	with nulls.
08300		The trailer  word contains the count  of the total words  in the
08400	item,   including  header   and  trailer  words.   This  duplicates  the
08500	information in the right half of the first header word.
08600	
08700	       TABs are handled in a pecular way. When a TAB occurs it is stored
08800	as  a TAB and  this is  followed by as  many spaces  as the TAB  in fact
08900	produces in the text and then by a terminating TAB.
09000	
09100	       end of comment ⊗
09200	
09300	NOLIT
09400	
09500	;Register	Most common usage
09600	
09700	F←0		;Flag bits
09800	A←1		;Argument value
09900	B←2		;CONTROL and META bits as stripped from command character.
10000	C←3		;Character
10100	D←4		;Dispatch table entry
10200	E←5		;Table location.
10300	G←6
10400	H←7
10500	I←10
10600	DSP←11		;Dispatch table location (CTAB most of the time).
10700	Q←14
10800	T←15
10900	TT←16
11000	P←17		;Always reserved as PDL pointer.
11100	
11200	DEFINE STOPJ
11300		{PUSHJ P,STOPJC	
11400		}	
11500	;Used to replace JRST 4,. and other fatal halts to inform ALS of trouble
11600	;STOPJ USED FOR JRST 4,. terminating with a JRST 4,. as usual
11700	;STOPC used for JRST 4,. WHEN ATTEMPT IS MADE TO CONTINUE
11800	
11900	IFNDEF PURESW<PURESW←←1>	;DEFAULT TO SHARABLE PURE UPPER SEGMENT
12000	IFNDEF DEBSW<DEBSW←←1>
12100	IFNDEF BOOKMD<BOOKMD←←1>
12200	;BOOKMD NON-ZERO PERMITS /B MODE FOR READING BOOKS.  0 DISABLES /B MODE.
12300	
12400	COPNUM←←3	;LOG OF # K OF CORE FOR TEMP COPY BUFFER
12500	SRSIZ←←40	;SIZE OF SEARCH STRING BUFFER
12600	LPDL←←69
12700	DPYBSZ←←=660*2
12800	
12900	DSKI←←1
13000	DSKO←←2
13100	DSKSP←←4	;Used for spooling file
13200	DSKCH←←5	;Used to write into bug file BUGFIL.LST[ALS,ALS]
13300	SWP←←3
13400	IFN BOOKMD, {
13500	RPGO←←4		;CHANNEL USED TO WRITE OUT .BKP FILE IN BKPSW MODE
13600	};END BOOKMD
13700	
13800	...←←0
13900	
14000	;Type of display (kept in cell called DPY)
14100	$TTY ←← 0	;Teletype kludge
14200	$DD  ←←	1	;Datadisk video type display
14300	$III ←←	2	;III Vector type display
     

00100	;RIGHT HALF FLAGS
00200	REDNLY←←1	;READ ONLY MODE
00300	COPY←←2		;NEED TO DO COPY (← OR →)
00400	DIROK←←4	;HAVE COMPLETE DIR
00500	UPDTXT←←10	;LINE 1 CHANGED - UPDATE DIR AT WRPAGE
00600	WRITE←←20	;SOMETHING CHANGED - NEED TO WRITE IT
00700	EOF←←40		;INPUT EOF DETECTED - DO ANOTHER LOOKUP (LOSING SYSTEM!)
00800	EDDIR←←100	;EDITING THE DIRECTORY PAGE
00900	ARG←←200	;ARG WAS TYPED TO COMMAND
01000	DSPSCR←←400	;REDISPLAY SCREEN
01100	DSPALL←←1000	;REDISPLAY WHOLE SCREEN
01200	FILLUZ←←2000	;EDITING NONSTANDARD FORMAT FILE
01300	REL←←4000	;RELATIVE ARG (+ OR -)
01400	NEG←←10000	;NEGATIVE ARG
01500	EDITM←←20000	;DISPATCH IS FROM LINE EDIT
01600	EDBRK←←40000	;(WITH EDITM) COMMAND TYPED IN MIDDLE OF LINE
01700	XPAGE←←100000	;WILL EXPAND FILE FOR PAGE
01800	UPDIR←←200000	;NON-TEXT CHANGE TO DIR
01900	ATTMOD←←400000	;IN ATTACH MODE
02000	
02100	;LEFT HALF FLAGS
02200	ENTRD←←1	;EDIT FILE HAS BEEN ENTERED
02300	CLRBF←←2	;CLEAR OBUF AFTER OUTPUT
02400	NOSHUF←←4	;DON'T SHUFFLE FREE STORAGE
02500	NOCHK←←10	;DON'T TRY TO CORE DOWN
02600	OFFEND←←20	;ARROW ON LINE N+1
02700	NULLIN←←40	;CURRENT LINE IS EMPTY
02800	ARRPG←←100	;ARROW POG IS SELECTED
02900	TF1←←200	;TEMP FLAG
03000	PMLIN←←400	;CURRENT LINE IS PAGE MARK
03100	OKF←←1000	;SHOULD TYPE "OK"
03200		;New flags added by ALS. May be represented by 3 bits if space gets tight.
03300	ALIN←←2000		;ALINE FLAG
03400	INDEN←←4000		;INDENT FLAG
03500	CEN←←10000		;CENTER FLAG
03600	JOINF←←20000		;JOIN FLAG
03700	ZATT←←40000		;To save ATTACH on a Z-EPSIL command.
03800	;	100000
03900	;	200000
04000	NGPUSE←←400000		;Network Graphic User